/**
 *
 * The MIT License
 *
 * Copyright (c) 2008 Board of Trustees, Leland Stanford Jr. University. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:

 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.

 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.macdadi.ks.client.data;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

/**
 * @author Ben Suter <ben.suter@gmail.com>
 */
public interface DataWriteService extends RemoteService
{
    /**
     * Utility/Convenience class.
     * Use DataWriteService.App.getInstance() to access static instance of DataWriteServiceAsync
     */
    public static class App
    {
        private static DataWriteServiceAsync ourInstance = null;

        public static synchronized DataWriteServiceAsync getInstance()
        {
            if (ourInstance == null) {
                ourInstance = (DataWriteServiceAsync) GWT.create(DataWriteService.class);
                ((ServiceDefTarget) ourInstance).setServiceEntryPoint(GWT.getModuleBaseURL() + "org.macdadi.ks.Main/DataWriteService");
            }
            return ourInstance;
        }
    }

    public Option createOption(int project, int author, String name, String authToken);

    public Option updateOption(int project, int option, String name, String authToken);

    public boolean removeOption(int project, int option, String authToken);

    public Goal createGoal(int project, int parent, String name, String authToken);

    public Goal updateGoal(int project, int goal, String name, String authToken);

    public boolean removeGoal(int project, int goal, String authToken);

    public StakeholderGroup createStakeholderGroup(int project, int parent, String name, String authToken);

    public StakeholderGroup updateStakeholderGroup(int project, int stakeholderGroup, String name, String authToken);

    public boolean removeStakeholderGroup(int project, int stakeholderGroup, String authToken);

    public boolean addMemberToStakeholderGroup(int project, int stakeholderGroup, int userId, String authToken);

    public boolean removeMemberFromStakeholderGroup(int project, int stakeholderGroup, int userId, String authToken);

    public boolean updatePreference(int project, int goal, int userId, int value, String authToken);

    public boolean updateImpact(int project, int goal, int option, int value, String authToken);

    public boolean addDesigner(int project, int userId, String authToken);

    public boolean removeDesigner(int project, int userId, String authToken);

    public boolean addDecisionMaker(int project, int userId, String authToken);

    public boolean removeDecisionMaker(int project, int userId, String authToken);

    public boolean addProjectMember(int project, int userId, String authToken);

    public boolean removeProjectMember(int project, int userId, String authToken);
}
